<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: Origami::Graphics::State</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">Origami::Graphics::State</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../../files/origami/graphics/state_rb.html">
                origami/graphics/state.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                Object
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">



   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000064">new</a>&nbsp;&nbsp;
      <a href="#M000065">reset</a>&nbsp;&nbsp;
      <a href="#M000067">restore</a>&nbsp;&nbsp;
      <a href="#M000066">save</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





    <div id="attribute-list">
      <h3 class="section-bar">Attributes</h3>

      <div class="name-list">
        <table>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">alpha_constant</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">alpha_source</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">blend_mode</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">clipping_path</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">ctm</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc">
Device-independent parameters.

</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">current_path</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">dash_pattern</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">line_cap</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">line_join</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">line_width</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">miter_limit</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">nonstroking_color</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">nonstroking_colorspace</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">rendering_intent</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">soft_mask</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">stroke_adjustment</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">stroking_color</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">stroking_colorspace</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">text_state</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        </table>
      </div>
    </div>
      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000064" class="method-detail">
        <a name="M000064"></a>

        <div class="method-heading">
          <a href="#M000064" class="method-signature">
          <span class="method-name">new</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000064-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000064-source">
<pre>
    <span class="ruby-comment cmt"># File origami/graphics/state.rb, line 51</span>
51:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>
52:         
53:         <span class="ruby-ivar">@stack</span> = []
54:         <span class="ruby-ivar">@current_path</span> = []
55:         <span class="ruby-ivar">@text_state</span> = <span class="ruby-constant">Text</span><span class="ruby-operator">::</span><span class="ruby-constant">State</span>.<span class="ruby-identifier">new</span>
56: 
57:         <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">reset</span>
58:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000065" class="method-detail">
        <a name="M000065"></a>

        <div class="method-heading">
          <a href="#M000065" class="method-signature">
          <span class="method-name">reset</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000065-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000065-source">
<pre>
    <span class="ruby-comment cmt"># File origami/graphics/state.rb, line 60</span>
60:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reset</span>
61: 
62:         <span class="ruby-ivar">@ctm</span> = <span class="ruby-constant">Matrix</span>.<span class="ruby-identifier">identity</span>(<span class="ruby-value">3</span>)
63:         <span class="ruby-ivar">@clipping_path</span> = <span class="ruby-keyword kw">nil</span>
64:         <span class="ruby-ivar">@stroking_colorspace</span> = <span class="ruby-ivar">@nonstroking_colorspace</span> = <span class="ruby-constant">Color</span><span class="ruby-operator">::</span><span class="ruby-constant">Space</span><span class="ruby-operator">::</span><span class="ruby-constant">DEVICE_GRAY</span>
65:         <span class="ruby-ivar">@stroking_color</span> = <span class="ruby-ivar">@nonstroking_color</span> = [ <span class="ruby-value">0</span><span class="ruby-value">.0</span> ] <span class="ruby-comment cmt">#black</span>
66:         <span class="ruby-ivar">@text_state</span>.<span class="ruby-identifier">reset</span>
67:         <span class="ruby-ivar">@line_width</span> = <span class="ruby-value">1.0</span>
68:         <span class="ruby-ivar">@line_cap</span> = <span class="ruby-constant">LineCapStyle</span><span class="ruby-operator">::</span><span class="ruby-constant">BUTT_CAP</span>
69:         <span class="ruby-ivar">@line_join</span> = <span class="ruby-constant">LineJoinStyle</span><span class="ruby-operator">::</span><span class="ruby-constant">MITER_JOIN</span>
70:         <span class="ruby-ivar">@miter_limit</span> = <span class="ruby-value">10.0</span>
71:         <span class="ruby-ivar">@dash_pattern</span> = <span class="ruby-constant">DashPattern</span>.<span class="ruby-identifier">new</span>([], <span class="ruby-value">0</span>)
72:         <span class="ruby-ivar">@rendering_intent</span> = <span class="ruby-constant">RenderingIntent</span><span class="ruby-operator">::</span><span class="ruby-constant">RELATIVE_COLORIMETRIC</span>
73:         <span class="ruby-ivar">@stroke_adjustment</span> = <span class="ruby-keyword kw">false</span>
74:         <span class="ruby-ivar">@blend_mode</span> = <span class="ruby-constant">BlendMode</span><span class="ruby-operator">::</span><span class="ruby-constant">NORMAL</span>
75:         <span class="ruby-ivar">@soft_mask</span> = <span class="ruby-identifier">:None</span>
76:         <span class="ruby-ivar">@alpha_constant</span> = <span class="ruby-value">1.0</span>
77:         <span class="ruby-ivar">@alpha_source</span> = <span class="ruby-keyword kw">false</span>
78: 
79:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000067" class="method-detail">
        <a name="M000067"></a>

        <div class="method-heading">
          <a href="#M000067" class="method-signature">
          <span class="method-name">restore</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000067-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000067-source">
<pre>
     <span class="ruby-comment cmt"># File origami/graphics/state.rb, line 95</span>
 95:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">restore</span>
 96:         <span class="ruby-identifier">raise</span> <span class="ruby-constant">GraphicsStateError</span>, <span class="ruby-value str">&quot;Cannot restore context : empty stack&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@stack</span>.<span class="ruby-identifier">empty?</span>
 97: 
 98:         <span class="ruby-ivar">@ctm</span>, <span class="ruby-ivar">@clipping_path</span>,
 99:         <span class="ruby-ivar">@stroking_colorspace</span>, <span class="ruby-ivar">@nonstroking_colorspace</span>,
100:         <span class="ruby-ivar">@stroking_color</span>, <span class="ruby-ivar">@nonstroking_color</span>,
101:         <span class="ruby-ivar">@text_state</span>, <span class="ruby-ivar">@line_width</span>, <span class="ruby-ivar">@line_cap</span>, <span class="ruby-ivar">@line_join</span>,
102:         <span class="ruby-ivar">@miter_limit</span>, <span class="ruby-ivar">@dash_pattern</span>, <span class="ruby-ivar">@rendering_intent</span>,
103:         <span class="ruby-ivar">@stroke_adjustment</span>,
104:         <span class="ruby-ivar">@blend_mode</span>, <span class="ruby-ivar">@soft_mask</span>, <span class="ruby-ivar">@alpha_constant</span>, <span class="ruby-ivar">@alpha_source</span> = <span class="ruby-ivar">@stack</span>.<span class="ruby-identifier">pop</span>
105:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000066" class="method-detail">
        <a name="M000066"></a>

        <div class="method-heading">
          <a href="#M000066" class="method-signature">
          <span class="method-name">save</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000066-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000066-source">
<pre>
    <span class="ruby-comment cmt"># File origami/graphics/state.rb, line 81</span>
81:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">save</span>  
82:         <span class="ruby-identifier">context</span> = 
83:         [
84:           <span class="ruby-ivar">@ctm</span>, <span class="ruby-ivar">@clipping_path</span>,
85:           <span class="ruby-ivar">@stroking_colorspace</span>, <span class="ruby-ivar">@nonstroking_colorspace</span>,
86:           <span class="ruby-ivar">@stroking_color</span>, <span class="ruby-ivar">@nonstroking_color</span>,
87:           <span class="ruby-ivar">@text_state</span>, <span class="ruby-ivar">@line_width</span>, <span class="ruby-ivar">@line_cap</span>, <span class="ruby-ivar">@line_join</span>,
88:           <span class="ruby-ivar">@miter_limit</span>, <span class="ruby-ivar">@dash_pattern</span>, <span class="ruby-ivar">@rendering_intent</span>,
89:           <span class="ruby-ivar">@stroke_adjustment</span>,
90:           <span class="ruby-ivar">@blend_mode</span>, <span class="ruby-ivar">@soft_mask</span>, <span class="ruby-ivar">@alpha_constant</span>, <span class="ruby-ivar">@alpha_source</span>
91:         ]
92:         <span class="ruby-ivar">@stack</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">context</span>)
93:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>